From: Siebrand Mazeland Date: Fri, 26 Apr 2013 07:48:46 +0000 (+0200) Subject: Remove unused local variables in tests X-Git-Tag: 1.31.0-rc.0~19865^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=483e29277fa03b1a2bfcd9a6a494368dc7caba8e;p=lhc%2Fweb%2Fwiklou.git Remove unused local variables in tests Change-Id: I71318eb7d8c00bfc1ce6d2fc636b498f7a695f42 --- diff --git a/tests/phpunit/includes/ArticleTablesTest.php b/tests/phpunit/includes/ArticleTablesTest.php index 967ffa17e0..d96a4533c2 100644 --- a/tests/phpunit/includes/ArticleTablesTest.php +++ b/tests/phpunit/includes/ArticleTablesTest.php @@ -16,14 +16,14 @@ class ArticleTablesTest extends MediaWikiLangTestCase { $wgContLang = Language::factory( 'es' ); $wgLang = Language::factory( 'fr' ); - $status = $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', 0, false, $user ); + $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', 0, false, $user ); $templates1 = $title->getTemplateLinksFrom(); $wgLang = Language::factory( 'de' ); $page->mPreparedEdit = false; // In order to force the rerendering of the same wikitext // We need an edit, a purge is not enough to regenerate the tables - $status = $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', EDIT_UPDATE, false, $user ); + $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', EDIT_UPDATE, false, $user ); $templates2 = $title->getTemplateLinksFrom(); $this->assertEquals( $templates1, $templates2 ); diff --git a/tests/phpunit/includes/TemplateCategoriesTest.php b/tests/phpunit/includes/TemplateCategoriesTest.php index a793babbba..fc15d02872 100644 --- a/tests/phpunit/includes/TemplateCategoriesTest.php +++ b/tests/phpunit/includes/TemplateCategoriesTest.php @@ -13,14 +13,14 @@ class TemplateCategoriesTest extends MediaWikiLangTestCase { $user = new User(); $user->mRights = array( 'createpage', 'edit', 'purge' ); - $status = $page->doEditContent( new WikitextContent( '{{Categorising template}}' ), 'Create a page with a template', 0, false, $user ); + $page->doEditContent( new WikitextContent( '{{Categorising template}}' ), 'Create a page with a template', 0, false, $user ); $this->assertEquals( array() , $title->getParentCategories() ); $template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) ); - $status = $template->doEditContent( new WikitextContent( '[[Category:Solved bugs]]' ), 'Add a category through a template', 0, false, $user ); + $template->doEditContent( new WikitextContent( '[[Category:Solved bugs]]' ), 'Add a category through a template', 0, false, $user ); // Run the job queue JobQueueGroup::destroySingletons(); diff --git a/tests/phpunit/includes/TimestampTest.php b/tests/phpunit/includes/TimestampTest.php index 2d550bc6b5..5d50c0a811 100644 --- a/tests/phpunit/includes/TimestampTest.php +++ b/tests/phpunit/includes/TimestampTest.php @@ -38,7 +38,7 @@ class TimestampTest extends MediaWikiTestCase { * @expectedException TimestampException */ function testInvalidParse() { - $timestamp = new MWTimestamp( "This is not a timestamp." ); + new MWTimestamp( "This is not a timestamp." ); } /** diff --git a/tests/phpunit/includes/api/ApiAccountCreationTest.php b/tests/phpunit/includes/api/ApiAccountCreationTest.php index 696b145c15..02c03a01a3 100644 --- a/tests/phpunit/includes/api/ApiAccountCreationTest.php +++ b/tests/phpunit/includes/api/ApiAccountCreationTest.php @@ -107,7 +107,7 @@ class ApiCreateAccountTest extends ApiTestCase { * @expectedException UsageException */ function testNoName() { - $ret = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'createaccount', 'token' => LoginForm::getCreateaccountToken(), 'password' => 'password', @@ -119,7 +119,7 @@ class ApiCreateAccountTest extends ApiTestCase { * @expectedException UsageException */ function testNoPassword() { - $ret = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'createaccount', 'name' => 'testName', 'token' => LoginForm::getCreateaccountToken(), diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index 88427665d0..a3d39dd712 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -6,7 +6,6 @@ * @group medium */ class ApiBlockTest extends ApiTestCase { - protected function setUp() { parent::setUp(); $this->doLogin(); @@ -36,7 +35,6 @@ class ApiBlockTest extends ApiTestCase { * previously always considered valid (bug 34212). */ function testMakeNormalBlock() { - $data = $this->getTokens(); $user = User::newFromName( 'UTApiBlockee' ); @@ -53,7 +51,7 @@ class ApiBlockTest extends ApiTestCase { $key = array_pop( $keys ); $pageinfo = $data[0]['query']['pages'][$key]; - $data = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'block', 'user' => 'UTApiBlockee', 'reason' => 'Some reason', @@ -66,7 +64,6 @@ class ApiBlockTest extends ApiTestCase { $this->assertEquals( 'UTApiBlockee', (string)$block->getTarget() ); $this->assertEquals( 'Some reason', $block->mReason ); $this->assertEquals( 'infinity', $block->mExpiry ); - } /** diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 7d8e01fa1d..f3b9a67325 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -161,13 +161,13 @@ class ApiEditPageTest extends ApiTestCase { if ( $text !== null ) { if ( $text === '' ) { // can't create an empty page, so create it with some content - list( $re, , ) = $this->doApiRequestWithToken( array( + $this->doApiRequestWithToken( array( 'action' => 'edit', 'title' => $name, 'text' => '(dummy)', ) ); } - list( $re, , ) = $this->doApiRequestWithToken( array( + list( $re ) = $this->doApiRequestWithToken( array( 'action' => 'edit', 'title' => $name, 'text' => $text, ) ); @@ -176,7 +176,7 @@ class ApiEditPageTest extends ApiTestCase { } // -- try append/prepend -------------------------------------------- - list( $re, , ) = $this->doApiRequestWithToken( array( + list( $re ) = $this->doApiRequestWithToken( array( 'action' => 'edit', 'title' => $name, $op . 'text' => $append, ) ); @@ -224,7 +224,7 @@ class ApiEditPageTest extends ApiTestCase { // try to save edit, expect conflict try { - list( $re, , ) = $this->doApiRequestWithToken( array( + $this->doApiRequestWithToken( array( 'action' => 'edit', 'title' => $name, 'text' => 'nix bar!', @@ -280,7 +280,7 @@ class ApiEditPageTest extends ApiTestCase { // try again, without following the redirect. Should fail. try { - list( $re, , ) = $this->doApiRequestWithToken( array( + $this->doApiRequestWithToken( array( 'action' => 'edit', 'title' => $rname, 'text' => 'nix bar!', diff --git a/tests/phpunit/includes/api/ApiParseTest.php b/tests/phpunit/includes/api/ApiParseTest.php index a42e5aa53b..475a2adf93 100644 --- a/tests/phpunit/includes/api/ApiParseTest.php +++ b/tests/phpunit/includes/api/ApiParseTest.php @@ -16,7 +16,7 @@ class ApiParseTest extends ApiTestCase { $somePage = mt_rand(); try { - $data = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'parse', 'page' => $somePage ) ); diff --git a/tests/phpunit/includes/api/ApiUploadTest.php b/tests/phpunit/includes/api/ApiUploadTest.php index 0d98b04d99..881fed5bd4 100644 --- a/tests/phpunit/includes/api/ApiUploadTest.php +++ b/tests/phpunit/includes/api/ApiUploadTest.php @@ -27,7 +27,6 @@ require_once( 'ApiTestCaseUpload.php' ); * This is pretty sucky... needs to be prettified. */ class ApiUploadTest extends ApiTestCaseUpload { - /** * Testing login * XXX this is a funny way of getting session context @@ -298,7 +297,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $exception = false; try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result, , $session ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); } catch ( UsageException $e ) { $exception = true; @@ -324,7 +323,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $exception = false; try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); // FIXME: leaks a temporary file } catch ( UsageException $e ) { $exception = true; @@ -341,7 +340,6 @@ class ApiUploadTest extends ApiTestCaseUpload { unlink( $filePaths[0] ); } - /** * @depends testLogin */ @@ -382,7 +380,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $exception = false; try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result, , $session ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); // FIXME: leaks a temporary file } catch ( UsageException $e ) { $exception = true; @@ -411,7 +409,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->clearFakeUploads(); $exception = false; try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); } catch ( UsageException $e ) { $exception = true; @@ -482,7 +480,7 @@ class ApiUploadTest extends ApiTestCaseUpload { if ( !$chunkSessionKey ) { // Upload fist chunk ( and get the session key ) try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result, , $session ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); } catch ( UsageException $e ) { $this->markTestIncomplete( $e->getMessage() ); @@ -509,7 +507,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->assertEquals( $resultOffset, $params['offset'] ); // Upload current chunk try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result, , $session ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); } catch ( UsageException $e ) { $this->markTestIncomplete( $e->getMessage() ); @@ -548,7 +546,7 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->clearFakeUploads(); $exception = false; try { - list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session, + list( $result ) = $this->doApiRequestWithToken( $params, $session, self::$users['uploader']->user ); } catch ( UsageException $e ) { $exception = true; diff --git a/tests/phpunit/includes/api/ApiWatchTest.php b/tests/phpunit/includes/api/ApiWatchTest.php index aefd939862..a9bc43ae3b 100644 --- a/tests/phpunit/includes/api/ApiWatchTest.php +++ b/tests/phpunit/includes/api/ApiWatchTest.php @@ -7,7 +7,6 @@ * @todo This test suite is severly broken and need a full review */ class ApiWatchTest extends ApiTestCase { - protected function setUp() { parent::setUp(); $this->doLogin(); @@ -95,8 +94,7 @@ class ApiWatchTest extends ApiTestCase { /** */ function testGetRollbackToken() { - - $pageinfo = $this->getTokens(); + $this->getTokens(); if ( !Title::newFromText( 'Help:UTPage' )->exists() ) { $this->markTestSkipped( "The article [[Help:UTPage]] does not exist" ); //TODO: just create it? @@ -168,7 +166,7 @@ class ApiWatchTest extends ApiTestCase { $this->assertArrayHasKey( 'delete', $data[0] ); $this->assertArrayHasKey( 'title', $data[0]['delete'] ); - $data = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'query', 'list' => 'watchlist' ) ); diff --git a/tests/phpunit/includes/cache/ProcessCacheLRUTest.php b/tests/phpunit/includes/cache/ProcessCacheLRUTest.php index c7e75d99c1..1070f7fc85 100644 --- a/tests/phpunit/includes/cache/ProcessCacheLRUTest.php +++ b/tests/phpunit/includes/cache/ProcessCacheLRUTest.php @@ -70,7 +70,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase { * @expectedException MWException */ function testConstructorGivenInvalidValue( $maxSize ) { - $c = new ProcessCacheLRUTestable( $maxSize ); + new ProcessCacheLRUTestable( $maxSize ); } /** diff --git a/tests/phpunit/includes/filerepo/FileRepoTest.php b/tests/phpunit/includes/filerepo/FileRepoTest.php index 7cc25b1bc6..033ae0b712 100644 --- a/tests/phpunit/includes/filerepo/FileRepoTest.php +++ b/tests/phpunit/includes/filerepo/FileRepoTest.php @@ -1,26 +1,25 @@ 'foobar' ) ); } @@ -29,7 +28,7 @@ class FileRepoTest extends MediaWikiTestCase { * @expectedException MWException */ function testFileRepoConstructionOptionNeedBackendKey() { - $f = new FileRepo( array( + new FileRepo( array( 'name' => 'foobar' ) ); } diff --git a/tests/phpunit/includes/upload/UploadFromUrlTest.php b/tests/phpunit/includes/upload/UploadFromUrlTest.php index ac93aa721a..ab2b5ee9cb 100644 --- a/tests/phpunit/includes/upload/UploadFromUrlTest.php +++ b/tests/phpunit/includes/upload/UploadFromUrlTest.php @@ -6,7 +6,6 @@ * @group Database */ class UploadFromUrlTest extends ApiTestCase { - protected function setUp() { parent::setUp(); @@ -236,7 +235,7 @@ class UploadFromUrlTest extends ApiTestCase { $this->assertFalse( (bool)$talk->getArticleID( Title::GAID_FOR_UPDATE ), 'User talk does not exist' ); - $data = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'upload', 'filename' => 'UploadFromUrlTest.png', 'url' => 'http://bits.wikimedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png', @@ -260,7 +259,7 @@ class UploadFromUrlTest extends ApiTestCase { $exception = false; try { - $data = $this->doApiRequest( array( + $this->doApiRequest( array( 'action' => 'upload', 'filename' => 'UploadFromUrlTest.png', 'url' => 'http://bits.wikimedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png', @@ -331,7 +330,6 @@ class UploadFromUrlTest extends ApiTestCase { return $data; } - /** * */ diff --git a/tests/phpunit/resources/ResourcesTest.php b/tests/phpunit/resources/ResourcesTest.php index 71b8c676d3..62a6b1411e 100644 --- a/tests/phpunit/resources/ResourcesTest.php +++ b/tests/phpunit/resources/ResourcesTest.php @@ -91,7 +91,7 @@ class ResourcesTest extends MediaWikiTestCase { $property = $reflectedModule->getProperty( $propName ); $property->setAccessible( true ); $lists = $property->getValue( $module ); - foreach ( $lists as $group => $list ) { + foreach ( $lists as $list ) { foreach ( $list as $key => $value ) { // We need the same filter as for 'lists', // due to 'skinStyles'. diff --git a/tests/selenium/suites/AddContentToNewPageTestCase.php b/tests/selenium/suites/AddContentToNewPageTestCase.php index 2803ff2a42..1237bb58d2 100644 --- a/tests/selenium/suites/AddContentToNewPageTestCase.php +++ b/tests/selenium/suites/AddContentToNewPageTestCase.php @@ -105,8 +105,6 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { // Add level 2 headline and verify output in the preview public function testAddLevel2HeadLine() { - $blnElementPresent = false; - $blnTextPresent = false; $this->getExistingPage(); $this->clickEditLink(); $this->loadWikiEditor();